Repository navigation
fix: fetch cookbook manifests at server API version 2 - #149
Merged
Merged
Conversation
Cookbooks.Get and CookbookArtifacts.Get fetched the manifest at the client's default API version 1. erchef answers v0/v1 by rebuilding the nine classic segments from the stored all_files and silently drops any file in another directory (chef_cookbook_version:populate_segments; wants_all_files is false below v2; artifacts the same via oc_chef_cookbook_artifact_version). Download and DownloadFiles then wrote a cookbook missing its ohai/, compliance/ and similar files with no error. Both Gets now ask for v2, as chef-client does by default, and receive all_files. Download goes through Cookbooks.Get, so it is covered too. cinc-server-ng returns every file at v1, which hid this; the new integration case pins the behaviour and AGENTS.md records the gap. Signed-off-by: Tim Smith <tsmith84@proton.me>
Signed-off-by: Tim Smith <tsmith84@proton.me>
Collaborator
Author
|
Filed cinc-project/cinc-server-ng#297: below API v2, cinc-server-ng files non-segment files under |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cookbooks.GetandCookbookArtifacts.Getfetched the manifest at the client's default API version 1. At v0/v1, erchef rebuilds the nine classic segments from the storedall_filesand silently drops any file in another directory:chef_cookbook_version:populate_segmentshas a comment saying exactly that, andwants_all_filesis false below v2. Artifacts behave the same way viaoc_chef_cookbook_artifact_version.DownloadandDownloadFilestherefore wrote cookbooks without theirohai/,compliance/,spec/and similar files, and returned no error.Both
Gets now ask for v2, as chef-client does by default (DEFAULT_SERVER_API_VERSION = "2"), and receiveall_files.Downloadgoes throughCookbooks.Get, so it is fixed too. The segment fields stay onCookbookfor servers that predate v2, andAllFiles()merges both shapes as before.cinc-server-ng returns every file at v1, which hid this. AGENTS.md now records the difference.
Test plan
X-Ops-Server-API-Version: 2on bothGets and onDownload. All failed before the fix, and the harness verifies each signature at that version.cookbooks/non-segment-files: a cookbook and an artifact withohai/andcompliance/files download byte for byte. It passes on cinc-server-ng either way; the erchef run is what tells.go test ./... -race -count=2,cd integration && go test ./..., golangci-lint in both modules